package com.example.demo.ai.common.config;

import com.github.xiaoymin.knife4j.solon.extension.OpenApiExtensionResolver;
import io.swagger.models.Scheme;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.docs.DocDocket;
import org.noear.solon.docs.models.ApiContact;
import org.noear.solon.docs.models.ApiInfo;

/**
 * @author airhead
 */
@Configuration
public class SwaggerConfig {
  @Inject private OpenApiExtensionResolver openApiExtensionResolver;

  @Bean("adminApi")
  public DocDocket adminApi() {
    DocDocket docDocket =
        new DocDocket()
            .groupName("Admin 端接口")
            .info(
                new ApiInfo()
                    .title("porpoise-demo")
                    .description("在线API文档")
                    .contact(new ApiContact().name("CrazyAirhead").email("l4qiang@hotmail.com"))
                    .version("1.0"))
            .schemes(Scheme.HTTP.toValue())
            .globalResponseInData(true)
            .vendorExtensions(openApiExtensionResolver.buildExtensions())
            .apis("com.example.demo");

    return docDocket;
  }
}
